<template>
	<sw-form-frame v-model="visible" :title="formName" width="640" :type="formType" :loading="btnLoading" footer @submit="handleSubmitForm()">
		<el-form ref="form" size="medium" :model="formData" :rules="formRules" label-width="66px" v-loading="loading">
			<el-form-item label="敏感词" prop="names">
				<el-select v-model="formData.names" v-bind="selectConfig"></el-select>
				<p class="tips">输入一个敏感词回车确定，可以进行多个敏感词的批量加入</p>
			</el-form-item>
		</el-form>
	</sw-form-frame>
</template>

<script>
import formMixins from '@/mixins/formMixins';
import { sensitiveDetail, batchAddedSensitive, updateSensitive } from '@/api/system/tbSysSensitive';
export default {
	mixins: [formMixins],
	data() {
		return {
			formName: '敏感词',
			selectConfig: {
				multiple: true,
				filterable: true,
				allowCreate: true,
				defaultFirstOption: true,
				style: { width: '100%' },
				placeholder: '敏感词名称',
				popperClass: 'sensitive_popper'
			},
			formRules: {
				names: [{ required: true, message: '请输入敏感词', trigger: 'change' }]
			}
		};
	},
	computed: {
		detailData() {
			return eval(sensitiveDetail);
		},
		callFunction() {
			return eval(this.addOrEdit ? batchAddedSensitive : updateSensitive);
		},
		submitParams() {
			let names = this.formData.names;
			return names.join();
		}
	},
	methods: {}
};
</script>

<style lang="scss">
.sensitive_popper {
	display: none;
}
</style>
